home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / OrganicBigTheme.java < prev    next >
Text File  |  1998-06-30  |  7KB  |  192 lines

  1. /*
  2.  * @(#)OrganicBigTheme.java    1.4 98/01/30
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.organic;
  22.  
  23. import com.sun.java.swing.plaf.*;
  24. import com.sun.java.swing.*;
  25. import com.sun.java.swing.border.*;
  26. import java.io.*;
  27. import java.awt.*;
  28.  
  29. /**
  30.  * This describes an example "Low Vision" theme for the Organic Look and Feel.
  31.  * It is commonly referred to as the "Dallas" theme.
  32.  * Its main intent is to be an example of the power and flexibility
  33.  *  of the theme's mechanism.
  34.  * We encourage others to use this mechanism to develop a theme
  35.  *  more applicable to people with vision problems.
  36.  *
  37.  * @version 1.4 01/30/98
  38.  * @author Steve Wilson
  39.  */
  40.  
  41. public class OrganicBigTheme extends OrganicGrayTheme{
  42.  
  43.     private final static String name = "Dallas";
  44.  
  45.     private final ColorUIResource control4  = new ColorUIResource( 51,  51,  51);
  46.     private final ColorUIResource control3  = new ColorUIResource(102, 102, 102);
  47.     private final ColorUIResource control2  = new ColorUIResource(153, 153, 153);
  48.     private final ColorUIResource control1  = new ColorUIResource(255, 255, 255);
  49.  
  50.     private final ColorUIResource control1AndHalf  = new ColorUIResource(204, 204, 204);
  51.  
  52.     private final FontUIResource systemFont = new FontUIResource("Dialog", Font.PLAIN, 24);
  53.     private final FontUIResource windowTitleFont = new FontUIResource("SansSerif", Font.BOLD, 24);
  54.     private final FontUIResource userFont = new FontUIResource("SansSerif", Font.PLAIN, 24);
  55.  
  56.     public String getName() {return name;}
  57.  
  58.     public ColorUIResource getControl1() { return control1; }
  59.     public ColorUIResource getControl2() { return control2; }
  60.     public ColorUIResource getControl3() { return control3; }
  61.     public ColorUIResource getControl4() { return control4; }
  62.  
  63.     public ColorUIResource getLightAccent1()  { return control2; }
  64.     public ColorUIResource getWhite()  { return control2; }
  65.  
  66.     public ColorUIResource getWindowFrameTop() { return getControl3(); }   
  67.     public ColorUIResource getWindowFrameBottom() { return getControl3(); }   
  68.     public ColorUIResource getWindowFrameRight() { return getControl3(); }   
  69.     public ColorUIResource getWindowFrameLeft() { return getControl3(); }   
  70.     public ColorUIResource getWindowFrameInactive() { return getControl4(); }   
  71.  
  72.     public ColorUIResource getMenuForeground() { return  getBlack(); }
  73.     public ColorUIResource getMenuSelectedForeground() { return  control1; }
  74.     public ColorUIResource getMenuItemForeground() { return  getBlack(); }
  75.     public ColorUIResource getMenuItemSelectedForeground() { return  control1; }
  76.     public ColorUIResource getMenuSelectedBackground() { return getBlack(); }
  77.  
  78.  
  79.     public ColorUIResource getWindowBackground() { return getControl1(); }
  80.     public ColorUIResource getWindowTitleBackground() { return getBlack(); }  
  81.     public ColorUIResource getWindowTitleInactiveBackground() { return getControl1(); }
  82.     public ColorUIResource getWindowTitleForeground() { return getControl1(); }
  83.     public ColorUIResource getWindowTitleInactiveForeground() { return getBlack(); }
  84.  
  85.     public ColorUIResource getTextHighlightColor() { return getBlack(); }
  86.     public ColorUIResource getHighlightedTextColor() { return getControl1(); }
  87.  
  88.     public FontUIResource getControlTextFont() { return systemFont;}
  89.     public FontUIResource getUserTextFont() { return userFont;}
  90.     public FontUIResource getMenuTextFont() { return systemFont;}
  91.     public FontUIResource getEmphasisTextFont() { return windowTitleFont;}
  92.  
  93.  
  94.     public void addCustomEntriesToTable(UIDefaults table) {
  95.  
  96.     Object checkBoxIcon = new UIDefaults.LazyValue() {
  97.         public Object createValue(UIDefaults table) {
  98.         return new OrganicBigCheckBoxIcon();
  99.         }
  100.     };
  101.  
  102.  
  103.         table.put ("CheckBox.icon", checkBoxIcon);
  104.         table.put ("ScrollBar.width", new Integer ( 20 ) );
  105.     table.put ("InternalFrameTitlePane.maximizeIcon", new MaximizeIcon() );
  106.     table.put ("InternalFrameTitlePane.altMaximizeIcon", new MaximizeIcon() );
  107.     table.put ("InternalFrameTitlePane.iconizeIcon", new IconizeIcon() );
  108.     table.put ("InternalFrameTitlePane.closeIcon", new CloseIcon() );
  109.         table.put ("TabbedPane.tabBackground", control1AndHalf );
  110.         table.put ("ScrollBar.track", getControl1());
  111.     table.put ("Tree.hash", getBlack());
  112.     }
  113. }
  114.  
  115.   // New icon for internal frame's maximize icon
  116.   class MaximizeIcon implements Icon, Serializable {
  117.     int height = 24;
  118.     int width = 24;
  119.     public void paintIcon(Component c, Graphics g, int x, int y) {
  120.       g.setColor(OrganicLookAndFeel.getControl2());
  121.  
  122.       g.translate( x+4, y+4 );
  123.  
  124.       g.drawRect(0,0, 16,16);
  125.       g.drawRect(1,1, 14,14);
  126.       g.drawRect(2,2, 12,12);
  127.  
  128.       g.drawLine(2,3, 14,3);
  129.       g.drawLine(2,4, 14,4);
  130.  
  131.       g.translate( -(x+4), -(y+4) );
  132.     }
  133.     public int getIconWidth() { return width; }
  134.     public int getIconHeight() { return height; }
  135.   };
  136.  
  137.   // New icon for internal frame's iconify icon
  138.   class IconizeIcon implements Icon, Serializable {
  139.     int height = 24;
  140.     int width = 24;
  141.     public void paintIcon(Component c, Graphics g, int x, int y) {
  142.       g.setColor(OrganicLookAndFeel.getControl2());
  143.  
  144.       g.translate( x+4, y+4 );
  145.  
  146.       g.fillRect(0,8, 16, 4);
  147.  
  148.  
  149.       g.translate( -(x+4), -(y+4) );
  150.     }
  151.     public int getIconWidth() { return width; }
  152.     public int getIconHeight() { return height; }
  153.   };
  154.  
  155.   // New icon for internal frame's close icon
  156.   class CloseIcon implements Icon, Serializable {
  157.     int height = 24;
  158.     int width = 24;
  159.     public void paintIcon(Component c, Graphics g, int x, int y) {
  160.       Color old = g.getColor();
  161.       g.setColor(OrganicLookAndFeel.getControl2());
  162.  
  163.       g.translate( x+4, y+4 );
  164.  
  165.       g.fillOval(0,0, 16,16);
  166.       g.setColor(old);
  167.       g.fillOval( 3,3, 10, 10);
  168.  
  169.       g.translate( -(x+4), -(y+4) );
  170.     }
  171.     public int getIconWidth() { return width; }
  172.     public int getIconHeight() { return height; }
  173.   };
  174.  
  175.   // New icon for checkbox to use
  176.   class OrganicBigCheckBoxIcon extends OrganicCheckBoxIcon {
  177.  
  178.     protected int getControlSize() { return 20; }
  179.  
  180.     protected Color getAccentColor() { return OrganicLookAndFeel.getControl2(); }
  181.     
  182.     protected void drawCheck(Component c, Graphics g, int x, int y) {
  183.     int controlSize = getControlSize();
  184.     g.fillRect( x+3, y+6, 3, controlSize-9 );
  185.  
  186.     g.drawLine( x+(controlSize-4), y+3, x+5, y+(controlSize-6) );
  187.     g.drawLine( x+(controlSize-3), y+3, x+5, y+(controlSize-5) );
  188.     g.drawLine( x+(controlSize-5), y+3, x+5, y+(controlSize-7) );
  189.     }
  190.  
  191. }
  192.